package com.bw.zg3park2212.carmanger

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.ToastUtils
import com.bw.base.entity.CarmangerAddParam
import com.bw.base.mvvm.BaseActivity
import com.bw.zg3park2212.carmanger.CarMangerViewModel
import com.bw.zg3park2212.databinding.ActivityCarMangnerAddBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = "/app/CarMangnerAddActivity")
class CarMangnerAddActivity : BaseActivity<ActivityCarMangnerAddBinding,CarMangerViewModel>() {
    override fun intitView() {
        binding.btnAdd.setOnClickListener {
            var carmangerAddParam=CarmangerAddParam()
            carmangerAddParam.licensePlate=binding.cmCarcode.text.toString()
            carmangerAddParam.ownerName=binding.cmName.text.toString()
            carmangerAddParam.provinceAbbreviation=binding.cmAddress.text.toString()
            viewmodel.carAdd(carmangerAddParam)
        }
    }

    override fun intitData() {
        viewmodel.carAddSuccse.observe(this){
            ToastUtils.showLong("添加成功")
            finish()
        }
    }

}